﻿using Dwgc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Teigha.DatabaseServices;
using Teigha.Geometry;

namespace Dwg_output
{
    class Wire_Board
    {
        private static int Termail_Board = 14;
        private static int Board_Num = 15;
        private static int area_id = 5;
        private static int control_id = 6;
        private static int addres =13;
        private static int base_B_IO = 12;
        private static int base_Mess_Num = 0;
        private static int safe_relay = 19;


        public static void Board_DO9011(Object T_DO9011, Database destDb, Point3d line_right, List<List<string>> tagtext, int point_y)
        {

            BlockReference blkRef2 = CopyAttributeBlock.AddAttributeReference(destDb, (ObjectId)T_DO9011, line_right.Add(new Vector3d(0, 26 - 13 - (4800 * (point_y - 1)), 0)), 0, 1);
            CopyAttributeBlock.GetAttributeVal(destDb, blkRef2, "T-DO9011_J");
            CopyAttributeBlock.SetAttributeVal(destDb, blkRef2, "端子板位置", tagtext[base_Mess_Num][Board_Num]);
            blkRef2.Dispose();
        }

        public static void Board_DI9011(Object T_DI9011, Database destDb, Point3d line_right, List<List<string>> tagtext, int point_y)
        {

            BlockReference blkRef2 = CopyAttributeBlock.AddAttributeReference(destDb, (ObjectId)T_DI9011, line_right.Add(new Vector3d(0, 26 - 13 - (4800 * (point_y - 1)), 0)), 0, 1);
            CopyAttributeBlock.GetAttributeVal(destDb, blkRef2, "T-DI9011_J");
            CopyAttributeBlock.SetAttributeVal(destDb, blkRef2, "端子板位置", tagtext[base_Mess_Num][Board_Num]);
            blkRef2.Dispose();
        }

        public static void Board_DI9001(Object T_DI9001, Database destDb, Point3d line_right, List<List<string>> tagtext, int point_y)
        {
            BlockReference blkRef2 = CopyAttributeBlock.AddAttributeReference(destDb, (ObjectId)T_DI9001, line_right.Add(new Vector3d(0, 26 - 13 - (4800 * (point_y - 1)), 0)), 0, 1);
            CopyAttributeBlock.GetAttributeVal(destDb, blkRef2, "T-DI9001_J");
            CopyAttributeBlock.SetAttributeVal(destDb, blkRef2, "端子板位置", tagtext[base_Mess_Num][Board_Num]);
            blkRef2.Dispose();



        }

        public static void Board_AI9001(Object T_AI9001, Database destDb, Point3d line_right, List<List<string>> tagtext, int point_y)
        {

            BlockReference blkRef21 = CopyAttributeBlock.AddAttributeReference(destDb, (ObjectId)T_AI9001, line_right.Add(new Vector3d(0, 26 - 13 - (4800 * (point_y - 1)), 0)), 0, 1);
            CopyAttributeBlock.GetAttributeVal(destDb, blkRef21, "T-AI9001_J");
            CopyAttributeBlock.SetAttributeVal(destDb, blkRef21, "端子板位置", tagtext[base_Mess_Num][Board_Num]);
            blkRef21.Dispose();
        }

        public static void Board_GT9001(Object T_GT9001, Database destDb, Point3d line_right, List<List<string>> tagtext, int point_y)
        {



            BlockReference blkRef2 = CopyAttributeBlock.AddAttributeReference(destDb, (ObjectId)T_GT9001, line_right.Add(new Vector3d(0, 26 - 13 - (4800 * (point_y - 1)), 0)), 0, 1);
            CopyAttributeBlock.GetAttributeVal(destDb, blkRef2, "T-GT9001_J");
            CopyAttributeBlock.SetAttributeVal(destDb, blkRef2, "端子板位置", tagtext[base_Mess_Num][Board_Num]);
            blkRef2.Dispose();
        }



        //SIS
        public static void Board_AI3201(Object T_GT9001, Database destDb, Point3d line_right, List<List<string>> tagtext, int point_y)
        {
            BlockReference blkRef2 = CopyAttributeBlock.AddAttributeReference(destDb, (ObjectId)T_GT9001, line_right.Add(new Vector3d(0, 26 - 13 - (4800 * (point_y - 1)), 0)), 0, 1);
            CopyAttributeBlock.GetAttributeVal(destDb, blkRef2, "T-AI3201_J");
            CopyAttributeBlock.SetAttributeVal(destDb, blkRef2, "端子板位置", tagtext[base_Mess_Num][Board_Num]);
            blkRef2.Dispose();
        }
        public static void Board_DI1601(Object T_DI1601, Database destDb, Point3d line_right, List<List<string>> tagtext, int point_y)
        {
            BlockReference blkRef2 = CopyAttributeBlock.AddAttributeReference(destDb, (ObjectId)T_DI1601, line_right.Add(new Vector3d(0, 26 - 13 - (4800 * (point_y - 1)), 0)), 0, 1);
            CopyAttributeBlock.GetAttributeVal(destDb, blkRef2, "T-DI1601_J");
            CopyAttributeBlock.SetAttributeVal(destDb, blkRef2, "端子板位置1", tagtext[base_Mess_Num][Board_Num]);
            CopyAttributeBlock.SetAttributeVal(destDb, blkRef2, "端子板位置2", tagtext[base_Mess_Num+16][Board_Num]);

            blkRef2.Dispose();
        }
        public static void Board_DO1601(Object T_DO1601, Database destDb, Point3d line_right, List<string> tagtext, int point_y,double y)
        {
            BlockReference blkRef2 = CopyAttributeBlock.AddAttributeReference(destDb, (ObjectId)T_DO1601, line_right.Add(new Vector3d(0, 26 - 13 - (4800 * (point_y - 1))-y, 0)), 0, 1);
            CopyAttributeBlock.GetAttributeVal(destDb, blkRef2, "T-DO1601_J2");
            CopyAttributeBlock.SetAttributeVal(destDb, blkRef2, "端子板位置", tagtext[Board_Num]);
            CopyAttributeBlock.SetAttributeVal(destDb, blkRef2, "端子板位置2", tagtext[Board_Num]);
            blkRef2.Dispose();

        }
        public static void Board_DO1602(Object T_DO1602, Database destDb, Point3d line_right, List<string> tagtext, int point_y,double y)
        {
            BlockReference blkRef2 = CopyAttributeBlock.AddAttributeReference(destDb, (ObjectId)T_DO1602, line_right.Add(new Vector3d(0, 26 - 13 - (4800 * (point_y - 1))-y, 0)), 0, 1);
            CopyAttributeBlock.GetAttributeVal(destDb, blkRef2, "T-DO1602_J2");
            CopyAttributeBlock.SetAttributeVal(destDb, blkRef2, "端子板位置", tagtext[Board_Num]);
            CopyAttributeBlock.SetAttributeVal(destDb, blkRef2, "端子板位置2", tagtext[Board_Num]);
            blkRef2.Dispose();
        }
        public static void Board_AI1601(Object T_DO1601, Database destDb, Point3d line_right, List<List<string>> tagtext, int point_y)
        {
            BlockReference blkRef2 = CopyAttributeBlock.AddAttributeReference(destDb, (ObjectId)T_DO1601, line_right.Add(new Vector3d(0, 26 - 13 - (4800 * (point_y - 1)), 0)), 0, 1);
            CopyAttributeBlock.GetAttributeVal(destDb, blkRef2, "T-AI1601_J2");
            CopyAttributeBlock.SetAttributeVal(destDb, blkRef2, "端子板位置", tagtext[base_Mess_Num][Board_Num]);
           // CopyAttributeBlock.SetAttributeVal(destDb, blkRef2, "端子板位置2", tagtext[base_Mess_Num + 16][Board_Num]);
            blkRef2.Dispose();
        }
        public static void Board_AO1601(Object T_AO1601, Database destDb, Point3d line_right, List<List<string>> tagtext, int point_y)
        {
            BlockReference blkRef2 = CopyAttributeBlock.AddAttributeReference(destDb, (ObjectId)T_AO1601, line_right.Add(new Vector3d(0, 26 - 13 - (4800 * (point_y - 1)), 0)), 0, 1);
            CopyAttributeBlock.GetAttributeVal(destDb, blkRef2, "T-AO1601_J");
            CopyAttributeBlock.SetAttributeVal(destDb, blkRef2, "端子板位置", tagtext[base_Mess_Num][Board_Num]);
            // CopyAttributeBlock.SetAttributeVal(destDb, blkRef2, "端子板位置2", tagtext[base_Mess_Num + 16][Board_Num]);
            blkRef2.Dispose();
        }

        public static void Board_BI9001_11(Object BI9001_11, Database destDb, Point3d line_right, List<List<string>> tagtext, int point_y)
        {
            string kajianxinghao;
            string[] addres_Spit = Split_String(tagtext[1][addres]);
            string address = "R" + addres_Spit[0] + "-" + addres_Spit[1];

            if (tagtext[1][base_B_IO].Equals("B-IO9001"))
            {
                 kajianxinghao = "冗余";
            }
            else
            {
                 kajianxinghao = "非冗余";
            }
            BlockReference blkRef2 = CopyAttributeBlock.AddAttributeReference(destDb, (ObjectId)BI9001_11, line_right.Add(new Vector3d(0, 26 - 13 - (4800 * (point_y - 1)), 0)), 0, 1);
            CopyAttributeBlock.GetAttributeVal(destDb, blkRef2, "转接端子基座通用块");
            CopyAttributeBlock.SetAttributeVal(destDb, blkRef2, "基座型号", tagtext[1][base_B_IO]);
            CopyAttributeBlock.SetAttributeVal(destDb, blkRef2, "卡件型号", kajianxinghao);
            CopyAttributeBlock.SetAttributeVal(destDb, blkRef2, "MB01", address);
            blkRef2.Dispose();
        }
        public static void Board_NumTag(Database destDb, Point3d pt1, List<List<string>> tagtext, int i, int j)
        {
            if (tagtext.Count ==0|| tagtext.Count == 1)
            { return; }
            if (tagtext[0].Count<14)
            { return; }

            if (tagtext[1][14].Equals("T-DO9011"))
            {
                if (tagtext[i][11].Equals("常开") && tagtext[i][3].Equals("干接点"))
                {
                    Creat_text_Dwg.ctrateText((i + 1) + "A", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText((i + 1) + "B", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);
                }

                else if (tagtext[i][11].Equals("常闭") && tagtext[i][3].Equals("干接点"))
                {
                    Creat_text_Dwg.ctrateText((i + 1) + "A", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText((i + 1) + "D", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);
                }

                else if (tagtext[i][11].Equals("常开") && tagtext[i][3].Equals("湿接点"))
                {
                    Creat_text_Dwg.ctrateText((i + 1) + "A", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText((i + 1) + "C", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);
                }
                else
                {
                    Creat_text_Dwg.ctrateText("cxc忠告您：没有此接线方式", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText("没有此接线方式", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);


                }

            }

            else if (tagtext[1][14].Equals("T-DI9011"))
            {


                if (tagtext[i][11].Equals("常开") &&( tagtext[i][3].Equals("干接点") || tagtext[i][3].Equals("湿接点")))
                {
                    Creat_text_Dwg.ctrateText((i + 1) + "B", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText((i + 1) + "A", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);
                }

                else
                {
                    Creat_text_Dwg.ctrateText("cxc忠告您：没有此接线方式", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText("没有此接线方式", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);


                }

            }

            else if (tagtext[1][14].Equals("T-DI9001"))
            {

                if (tagtext[i][11].Equals("常开") && (tagtext[i][3].Equals("干接点") || tagtext[i][3].Equals("湿接点")))
                {
                    Creat_text_Dwg.ctrateText((i + 1) + "A", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText((i + 1) + "B", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);
                }

                else
                {
                    Creat_text_Dwg.ctrateText("cxc忠告您：没有此接线方式", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText("没有此接线方式", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);


                }


            }
            else if (tagtext[1][14].Equals("T-AI9001"))
            {

                if (tagtext[i][11].Equals("二线制")&& tagtext[i][safe_relay].Equals(""))
                {
                    Creat_text_Dwg.ctrateText((i + 1) + "A", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText((i + 1) + "B", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);
                }
              

                else if (tagtext[i][11].Equals("四线制")|| tagtext[i][11].Equals("三线制") ||  !tagtext[i][safe_relay].Equals(""))
                {
                    Creat_text_Dwg.ctrateText((i + 1) + "B", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText((i + 1) + "C", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);
                }


                else
                {
                    Creat_text_Dwg.ctrateText("cxc忠告您：没有此接线方式，请检查", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText("没有此接线方式，请检查", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);

                }
            }
            else if (tagtext[1][14].Equals("T-GT9001"))
            {

                if ((tagtext[i][3].Equals("4-20mA") && tagtext[i][10].Equals("AO")) || ((tagtext[i][3].Equals("TC") || (tagtext[i][3].Equals("4-20mA")) && tagtext[i][10].Equals("AI"))))
                {
                    Creat_text_Dwg.ctrateText((i + 1) + "A", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText((i + 1) + "B", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);
                }

                else if (tagtext[i][3].Equals("RTD") && tagtext[i][10].Equals("AI") && tagtext[i][11].Equals("三线制"))
                {

                    Creat_text_Dwg.ctrateText((j + 1) + "A", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText((j + 1) + "B", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText((j + 1 + 1) + "A", destDb, pt1.Add(new Vector3d(0, 3 - 26 - 26, 0)), 20, 0, 0);

                }
                else
                {
                    Creat_text_Dwg.ctrateText("cxc忠告您：没有此接线方式，请检查", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText("没有此接线方式，请检查", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);


                }
            }
            else if (tagtext[1][base_B_IO].Equals("B-IO9001")|| tagtext[1][base_B_IO].Equals("B-IO9011"))
            {

                if ((tagtext[i][3].Equals("4-20mA") && tagtext[i][10].Equals("AO")) || ((tagtext[i][3].Equals("TC") || (tagtext[i][3].Equals("4-20mA")) && tagtext[i][10].Equals("AI"))))
                {
                    Creat_text_Dwg.ctrateText((i + 1) + "A", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText((i + 1) + "B", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);
                }

                else if (!tagtext[i][3].Equals("4-20mA") && tagtext[i][10].Equals("AI") && tagtext[i][11].Equals("三线制"))
                {

                    Creat_text_Dwg.ctrateText((j + 1) + "A", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText((j + 1) + "B", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText((j + 1 + 1) + "A", destDb, pt1.Add(new Vector3d(0, 3 - 26 - 26, 0)), 20, 0, 0);

                }
                else
                {
                    Creat_text_Dwg.ctrateText("cxc忠告您：没有此接线方式，请检查", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText("没有此接线方式，请检查", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);


                }
            }

            else if (tagtext[1][14].Equals("T-AI3201")|| tagtext[1][14].Equals("T-AI1601"))
            {

                if (tagtext[i][11].Equals("二线制") && tagtext[i][safe_relay].Equals(""))
                {
                    Creat_text_Dwg.ctrateText((i + 1) + "S+", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText((i + 1) + "AI+", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);
                }


                else if (tagtext[i][11].Equals("四线制") || tagtext[i][11].Equals("三线制") || !tagtext[i][safe_relay].Equals(""))
                {
                    Creat_text_Dwg.ctrateText((i + 1) + "AI+", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText((i + 1) + "AI-", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);
                }


                else
                {
                    Creat_text_Dwg.ctrateText("cxc忠告您：没有此接线方式，请检查", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText("没有此接线方式，请检查", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);

                }
            }

            else if (tagtext[1][14].Equals("T-DI1601"))
            {

                if (tagtext[i][3].Equals("干接点") )
                {
                    Creat_text_Dwg.ctrateText((i + 1) + "DI+", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText((i + 1) + "DI-", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);
                }



                else
                {
                    Creat_text_Dwg.ctrateText("cxc忠告您：没有此接线方式，，请检查"+ tagtext[i][11].ToString(), destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText("没有此接线方式，请检查", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);

                }
            }
            else if (tagtext[i][14].Equals("T-DO1601"))
            {

                if (tagtext[i][3].Equals("湿接点"))
                {
                    Creat_text_Dwg.ctrateText((i + 1) + "DO+", destDb, pt1.Add(new Vector3d(0, 3, 0)), 15, 0, 0);
                    Creat_text_Dwg.ctrateText((i + 1) + "DO-", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 15, 0, 0);
                }
                else if (tagtext[i][3].Equals("干接点") && ! tagtext[i][safe_relay].Equals(""))
                {
                    Creat_text_Dwg.ctrateText((i + 1) + "DO+", destDb, pt1.Add(new Vector3d(0, 3, 0)), 15, 0, 0);
                    Creat_text_Dwg.ctrateText((i + 1) + "DO-", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 15, 0, 0);
                }

                else if (tagtext[i][3].Equals("干接点") &&  tagtext[i][safe_relay].Equals(""))
                {
                    Creat_text_Dwg.ctrateText("cxc忠告您：干接点接线方式，请检查", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText("没有干接点接线方式，请检查", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);
                }

                else
                {
                    Creat_text_Dwg.ctrateText("cxc忠告您：没有此接线方式，请检查", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText("没有此接线方式，请检查", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);

                }
            }
            else if (tagtext[i][14].Equals("T-DO1602"))
            {

                if (tagtext[i][11].Equals("常开") && tagtext[i][3].Equals("湿接点"))
                {

                    Creat_text_Dwg.ctrateText((i + 1) + "NO", destDb, pt1.Add(new Vector3d(0, 3, 0)), 15, 0, 0);
                    Creat_text_Dwg.ctrateText((i + 1) + "GND-", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 15, 0, 0);

                }
                else if (tagtext[i][11].Equals("常开") && tagtext[i][3].Equals("干接点") && tagtext[i][safe_relay].Equals(""))
                {


                    Creat_text_Dwg.ctrateText((i + 1) + "NO", destDb, pt1.Add(new Vector3d(0, 3, 0)), 15, 0, 0);
                    Creat_text_Dwg.ctrateText((i + 1) + "C", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 15, 0, 0);


                }
                else if (tagtext[i][11].Equals("常闭") && tagtext[i][3].Equals("干接点") && tagtext[i][safe_relay].Equals(""))  
                {


                    Creat_text_Dwg.ctrateText((i + 1) + "NC", destDb, pt1.Add(new Vector3d(0, 3, 0)), 15, 0, 0);
                    Creat_text_Dwg.ctrateText((i + 1) + "C", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 15, 0, 0);


                }
                else if (tagtext[i][11].Equals("常开") && tagtext[i][3].Equals("干接点") && !tagtext[i][safe_relay].Equals(""))   //有安全删
                {


                    Creat_text_Dwg.ctrateText((i + 1) + "NC", destDb, pt1.Add(new Vector3d(0, 3, 0)), 15, 0, 0);
                    Creat_text_Dwg.ctrateText((i + 1) + "C", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 15, 0, 0);


                }



                else
                {
                    Creat_text_Dwg.ctrateText("cxc忠告您：没有此接线方式，请检查", destDb, pt1.Add(new Vector3d(0, 3, 0)), 20, 0, 0);
                    Creat_text_Dwg.ctrateText("没有此接线方式，请检查", destDb, pt1.Add(new Vector3d(0, 3 - 26, 0)), 20, 0, 0);

                }
            }



        }

        public static void Board_DB_Line(Database destDb, Point3d pt1, List<List<string>> tagtext, Dictionary<int, string> Dict_sys_jigui, Dictionary<int, string> Dict_jigui, int point_y)
        {
            if (tagtext.Count<=2)
            {
                return;
            }
            if (tagtext[1][base_B_IO].Equals("B-IO9001") || tagtext[1][base_B_IO].Equals("B-IO9011"))
            {
                return;
            }
            string sys_jigui_name = Read_Dionary(Dict_sys_jigui, int.Parse(tagtext[1][control_id]));
            string jigui_name = Read_Dionary(Dict_jigui, int.Parse(tagtext[1][area_id]));
            string[] addres_Spit = Split_String(tagtext[1][addres]);
            //  string[] addres_Spit2 = Split_String(tagtext[16][addres]);
            Point3d pt2;



            //DCS
            if (!(tagtext[1][Termail_Board].Equals("T-AI3201") || tagtext[1][Termail_Board].Equals("T-DI1601")|| tagtext[1][Termail_Board].Equals("T-DO1602")
                || tagtext[1][Termail_Board].Equals("T-DO1601") || tagtext[1][Termail_Board].Equals("T-AO1601") || tagtext[1][Termail_Board].Equals("T-AI1601")))
            {
                if (tagtext.Count < 17)
                {
                    pt2 = pt1.Add(new Vector3d(1868, -750 - (4800 * (point_y - 1)), 0));
                }

                else
                {
                    pt2 = pt1.Add(new Vector3d(1868, -1608 - (4800 * (point_y - 1)), 0));
                }


                if (sys_jigui_name.Equals(jigui_name))
                {
                    string DB_Name = "R" + addres_Spit[0] + "-" + addres_Spit[1] + "/" + tagtext[0][Board_Num];
                    Creat_text_Dwg.ctrateText(DB_Name, destDb, pt2, 15, 0, 0);
                }
                else
                {
                    string DB_Name = sys_jigui_name + "-" + "R" + addres_Spit[0] + "-" + addres_Spit[1] + "/" + jigui_name + "-" + tagtext[0][Board_Num];
                    Creat_text_Dwg.ctrateText(DB_Name, destDb, pt2, 15, 0, 0);
                }
            }
            //SIS
            else
            {
                //AO1601
                if (tagtext[1][Termail_Board].Equals("T-AO1601") || tagtext[1][Termail_Board].Equals("T-AI1601"))
                {
                    pt2 = pt1.Add(new Vector3d(1868, -740 - (4800 * (point_y - 1)), 0));

                    if (sys_jigui_name.Equals(jigui_name))
                    {
                        string DB_Name = "C" + addres_Spit[0] + "S" + addres_Spit[1] + "L" + "/" + tagtext[0][Board_Num];
                        Creat_text_Dwg.ctrateText(DB_Name, destDb, pt2, 15, 0, 0);
                    }
                    else
                    {
                        string DB_Name = sys_jigui_name + "-" + "C" + addres_Spit[0] + "-" + addres_Spit[1] + "/" + jigui_name + "-" + tagtext[0][Board_Num];
                        Creat_text_Dwg.ctrateText(DB_Name, destDb, pt2, 15, 0, 0);
                    }

                }

                //AO1601
                else if (tagtext[1][Termail_Board].Equals("T-AI3201"))
                {
                    pt2 = pt1.Add(new Vector3d(1868, -1608 - (4800 * (point_y - 1)), 0));

                    if (sys_jigui_name.Equals(jigui_name))
                    {
                        string DB_Name = "C" + addres_Spit[0] + "S" + addres_Spit[1] + "LR" + "/" + tagtext[0][Board_Num];
                        Creat_text_Dwg.ctrateText(DB_Name, destDb, pt2, 15, 0, 0);
                    }
                    else
                    {
                        string DB_Name = sys_jigui_name + "-" + "C" + addres_Spit[0] + "-" + addres_Spit[1] + "/" + jigui_name + "-" + tagtext[0][Board_Num];
                        Creat_text_Dwg.ctrateText(DB_Name, destDb, pt2, 15, 0, 0);
                    }

                }

                //AO1601
                else if (tagtext[1][Termail_Board].Equals("T-DI1601") || tagtext[1][Termail_Board].Equals("T-DO1601") || tagtext[1][Termail_Board].Equals("T-DO1602"))
                {//728
                    pt2 = pt1.Add(new Vector3d(1868, -730 - (4800 * (point_y - 1)), 0));

                    if (sys_jigui_name.Equals(jigui_name))
                    {
                        string DB_Name1 = "C" + addres_Spit[0] + "S" + addres_Spit[1] + "L" + "/" + tagtext[0][Board_Num];
                       // string DB_Name2 = "C" + addres_Spit[0] + "S" + addres_Spit[1] + "R" + "/" + tagtext[16][Board_Num];
                        Creat_text_Dwg.ctrateText(DB_Name1, destDb, pt2, 15, 0, 0);
                       // Creat_text_Dwg.ctrateText(DB_Name2, destDb, pt2.Add(new Vector3d(0, -1723, 0)), 15, 0, 0);
                    }
                    else
                    {
                        string DB_Name1 = sys_jigui_name + "-" + "C" + addres_Spit[0] + "-" + addres_Spit[1] + "/" + jigui_name + "-" + tagtext[0][Board_Num];
                        //string DB_Name2 = sys_jigui_name + "-" + "C" + addres_Spit[0] + "-" + addres_Spit[1] + "/" + jigui_name + "-" + tagtext[16][Board_Num];
                        Creat_text_Dwg.ctrateText(DB_Name1, destDb, pt2, 15, 0, 0);
                      //  Creat_text_Dwg.ctrateText(DB_Name2, destDb, pt2.Add(new Vector3d(0, -1723, 0)), 15, 0, 0);
                    }
                }

                else
                {
                    pt2 = pt1.Add(new Vector3d(1868, -1608 - (4800 * (point_y - 1)), 0));
                }




            }




        }

        public static string Read_Dionary(Dictionary<int, string> memberMap, int id)
        {

            string members = memberMap[id];

            return members;
        }

        public static string[]  Split_String(string input)
        {

          
              string[] parts = input.Split('|');


               return parts;

        }
        

    }
}
